package vmcs.simulationsystem;

import java.awt.event.ActionListener;

import vmcs.common.Constant;
import vmcs.controller.MainController;
import vmcs.controller.MaintenanceController;
import vmcs.controller.SimulationController;
import vmcs.controller.TransactionController;

public class ActionListenerFactory {
	private MainController mainCtrl;
	private SimulationController simulationCtrl;
	private TransactionController transactionctrl;
	private MaintenanceController maintenancecontroller;

	public ActionListenerFactory(MainController controller){
		this.simulationCtrl = controller.getSimulationController();
		this.mainCtrl = controller;		
		this.transactionctrl = controller.getTransactionController();
		this.maintenancecontroller = controller.getMaintenanceController();
	}
	//ActionListenerFactory(SimulationController controller){
	//this.simulationCtrl = controller;	
	//}
	public ActionListener getButtonListener(String ButtonListenerType){
		switch(ButtonListenerType){
		case Constant.L_SIMUL_BEGIN: return new BeginSimulationButtonListener(this.simulationCtrl);
		case Constant.L_ACT_MAINTAINER: return new ActivateMaintainerPanelButtonListener(this.simulationCtrl);
		case Constant.L_ACT_MACHINERY: return new ActivateMachineryPanelButtonListener(this.simulationCtrl);
		case Constant.L_ACT_CUSTOMER: return new ActivateCustomerPanelButtonListener(this.simulationCtrl);
		case Constant.L_SIMUL_END: return new EndSimulationButtonListener(this.mainCtrl);
		case Constant.CUST_TR_TRANS:  return new TerminateButtonListener(this.transactionctrl);
		case Constant.ACC_MGR:   return new PasswordListener(this.maintenancecontroller.getAccessManager());
		case Constant.M_TOTAL_CASH:  return new TotalCashButtonListener(maintenancecontroller);
		case Constant.TRANS_CASH:  return new TransferCashButtonListener(maintenancecontroller);
		case Constant.M_EXIT:  return new ExitButtonListener(this.maintenancecontroller);
		default: return null;

		}

	}

}
